/*
 *  Ship.h
 *  SpaceTrader
 *
 *  Created by Jake on 9/24/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */
#include <iostream>
#include "GuiTools.h"
#include "SpaceTrader.h"
#include <vector>
#include "Laser.h"
#include "boost/archive/text_oarchive.hpp"
#include "boost/archive/text_iarchive.hpp"
#include <fstream>
#pragma once

class Ship 
{
private:
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        //serialization
        ar & attack;
        ar & defense;
        ar & speed;
        ar & health;
        ar & xVel;
        ar & yVel;
        //ar & bounds;
        //ar & icon;
        ar & fuelCapacity;
        ar & currFuel;
    }
	//Equipment curr_equip;

	int attack, defense, speed, health;
	SDL_Rect bounds;
	int xVel, yVel;
	int fuelCapacity, currFuel;
	SDL_Surface *icon;
	std::vector<Laser*> lasers;
    bool isDestroyed;
public:
	Ship();
	
	Ship(int attack, int defense, int speed, int health, const std::string image);
    
    Ship(int attack, int defense, int speed, int health, int yVel, const std::string image);
    
    Ship(const Ship &S);
    
    ~Ship();
    
    Ship& operator=(const Ship &S);
	
	//Equipment getEquipment();
	
	int *getStats();
	
	int getFuel();
    
    int getCapacity();

	int getXVel();
    void setXVel(int v);

	int getYVel();
    void setYVel(int v);

	int getX();

	int getY();

	int getH();
    
    void shoot();

	//std::vector<std::vector<bool> > getLasers();
	std::vector<Laser*> getLasers();

	void setLasers(std::vector<Laser*>);

	void setStats();
	
	void setX(int);

	void setY(int);

	//void setLasers(std::vector<std::vector<bool> > lasers);
	//void setLasers(std::vector<Laser*>);

	void setFuel(int fuel);

	//handles key presses
	void handle_input(SDL_Event event);
	
	//Moves ship
	//void move(SDL_Rect wall);
	void move();
    
    //checks to see if hit
    bool checkIfHit(std::vector<Laser*> lasers);
    
	//Displays ship on the screen
	void show(SDL_Surface *screen);
};
